package com.itheima.mapper;

import com.itheima.domain.Employee;
import com.itheima.dto.LoginDto;
import com.itheima.vo.LoginVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * date: 2022/5/12 17:30
 *
 * @author daya000
 */
@Mapper
public interface EmployeeMapper {
    /**
     * 员工登录
     * @param dto
     * @return
     */
    LoginVo login(LoginDto dto);

    /**
     * 登录成功就存放到redis缓存里面
     * @param dto
     * @return
     */
    Employee loginRedis(LoginDto dto);


    /**
     * 添加管理员员工
     * @param employee
     * @return
     */
    int addEmployee(Employee employee);

    /**
     * 通过用户名查询
     * @param username
     * @return
     */
    Employee selectByUsername(String username);

    /**
     * 根据id更新
     * @param employee
     * @return
     */
    int updateEmployee(Employee employee);

    /**
     * 分页查询
     * @param page
     * @param pageSize
     * @return
     */
    List<Employee> selectByPage(@Param("name") String name,@Param("page") Integer page,@Param("pageSize") Integer pageSize);

    /**
     *
     * @param name
     * @return
     */
    Long selectTotal(@Param("name") String name);

    Employee selectById(String id);
}
